// pages/zhuye_yuyuezixun/zhuye_yuyuezixun.js
import {request} from "../../utils/http.js"
const app = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    show:false,
    zhuangtai:-1,
    dengji:"国家一级心理咨询师",
    leibie:"压力情绪",
    shijian:"2024·10·22 21:27",
    dengjilist:[],
    leibielist:[
      // "家庭关系","亲子关系","婚恋感情","生活问题",
      // "个体咨询","人际关系","压力情绪","儿童心理",
      // "青少年","成年人","职场问题","心理危机干预",
      // "精神疾病治疗","抑郁症","老年心理","忧郁症",
      // "成瘾性问题","性相关问题"
    ],
    time1:"",
    time2:"00:00",
    minHour:0,
    maxHour:23,
    time:1,
    value: '',
    consultantLevelId:'',
    fieldNameId:'',
  },

  
  to(e){
    const title = e.currentTarget.dataset.title;
    const id1 = e.currentTarget.dataset.id1;
    const id2 = e.currentTarget.dataset.id2;
    const consultationType = e.currentTarget.dataset.leibie;
    const consultationTime = e.currentTarget.dataset.time1+','+e.currentTarget.dataset.time2;
    const consultationContent = e.currentTarget.dataset.value;
    const systemUserId = app.globalData.userId

    wx.navigateTo({
      url: '/pages/zhuye_yuyuezixun_tuanjianjieguo/zhuye_yuyuezixun_tuanjianjieguo?consultantLevelId='+id1+'&fieldNameId='+id2+'&title='+title+'&consultationType='+consultationType+'&consultationTime='+consultationTime+'&consultationContent='+consultationContent+'&systemUserId='+systemUserId
    })
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    request({
      url:"/consultantLevel/findAll",
    }).then((data)=>{
      console.log(data.data);
      this.setData({
        dengjilist:data.data
      })
    }),
    request({
      url:"//fieldOfExcellence/findAll",
    }).then((data)=>{
      console.log(data.data);
      this.setData({
        leibielist:data.data
      })
    })

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {
    var date = new Date();
    this.setData({
      time1:(date.getYear()+1900)+"·"+(date.getMonth()+1)+"·"+(date.getDate())
    })
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },
  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  },
  fanhuei(){
    wx.navigateBack();
  },
  onClose(){
    this.setData({
      show:false
    })
  },
  show(e){
    console.log(e);
    this.setData({
      show:true,
      zhuangtai:e.currentTarget.id
    })
  },
  dianji(e){

    this.setData({
      show:false,
      dengji:e.currentTarget.id,
      consultantLevelId:e.currentTarget.dataset.id1
    })
    console.log(e.currentTarget.dataset.id1);
   
  },
  leibie(e){
    this.setData({
      show:false,
      leibie:e.currentTarget.id,
      fieldNameId:e.currentTarget.dataset.id2
    })
    console.log(e.currentTarget.dataset.id2);
  },
  time(e){
    this.setData({
      time1:(e.detail.getYear()+1900)+"·"+(e.detail.getMonth()+1)+"·"+(e.detail.getDate())
    })
  },
  totime(e){
    this.setData({
      time:e.currentTarget.id
    })
    console.log(e.currentTarget.id);
  },
  onInput(e){
    this.setData({
      time2:e.detail
    })
  },
  value(e){
    this.setData({
      value:e.detail
    })
    console.log(e.detail);
  }
})